define([
    "UtilDir/util",
    "UtilDir/tool",
    "UtilDir/org/selectOrg",
    "UtilDir/searchBlock",
    "static/app/hddc/hddccjcommon/hddccjCommon",
    "Date","DateCN", "css!DateCss",
    "EasyUI","EasyUI-lang"
],function(Util, Tool, SelectOrg, SearchBlock,HddccjCommon){
    //B2_GeomorphySvy（地貌调查）
    //获取线路|面经纬度数组
    var getLonLatArray = function(LonLatString){
        var LonLatArray = [];//经纬度数组
        var strArray = LonLatString.split(";");
        if(strArray!=null && strArray.length>0){
            for(var i=0;i<strArray.length;i++){
                var str = strArray[i];
                var lonlatStrArray = str.split(",");
                if(lonlatStrArray!=null && lonlatStrArray.length==2){
                    var lonStr = lonlatStrArray[0];
                    var latStr = lonlatStrArray[1];
                    if(lonStr!="" && latStr!=""){
                        var lon = parseFloat(lonStr);
                        var lat = parseFloat(latStr);
                        if(lon>0 && lon<180 && lat>0 && lat<90){
                            //经纬度
                            var lonlat = [lon,lat];
                            //添加经纬度
                            LonLatArray.push(lonlat);
                        }
                    }
                }
            }
        }
        return LonLatArray;
    };

    //31-微地貌测量线-线
    var getHddcGeomorphysvylineController = function(){
        return getServer() + "/hddc/hddcGeomorphysvylines";
    };
    var initQueryGeomorphySvyLineData = function () {
        console.log("31-微地貌测量线-线");
        var allLonLatArray = [];
        var allUuidArray = [];
        var allDataArray=[];
        $.ajax({
            url: getHddcGeomorphysvylineController() + "/queryAllSpaceData/",
            type: "get",
            async:true,
            success: function (data) {
                for(var i=0;i<data.length;i++){
                    var LonLatString = data[i].extends5;//经纬度字符串
                    if(LonLatString!=null && LonLatString!=""){
                        var LonLatArray = getLonLatArray(LonLatString);//获取经纬度数组
                        //添加经纬度数组
                        allLonLatArray.push(LonLatArray);
                        //添加UUID
                        allUuidArray.push(data[i].uuid);
                    }
                }
                allDataArray = [allUuidArray,allLonLatArray];
            }
        });
        return allDataArray;
    };

    //32-微地貌测量面-面
    var getHddcGeomorphysvyregionController = function(){
        return getServer() + "/hddc/hddcGeomorphysvyregions";
    };
    var initQueryGeomorphySvyRegionData = function () {
        console.log("32-微地貌测量面-面");
        var allLonLatArray = [];
        var allUuidArray = [];
        var allDataArray=[];
        $.ajax({
            url: getHddcGeomorphysvyregionController() + "/queryAllSpaceData/",
            type: "get",
            async:true,
            success: function (data) {
                for(var i=0;i<data.length;i++){
                    var LonLatString = data[i].extends5;//经纬度字符串
                    if(LonLatString!=null && LonLatString!=""){
                        var LonLatArray = getLonLatArray(LonLatString);//获取经纬度数组
                        //添加经纬度数组
                        allLonLatArray.push(LonLatArray);
                        //添加UUID
                        allUuidArray.push(data[i].uuid);
                    }
                }
                allDataArray = [allUuidArray,allLonLatArray];
            }
        });
        return allDataArray;
    };

    //33-微地貌面测量切线-线
    var getHddcGeomorphysvyreprofController = function(){
        return getServer() + "/hddc/hddcGeomorphysvyreprofs";
    };
    var initQueryGeomorphySvyReProfData = function () {
        console.log("33-微地貌面测量切线-线");
        var allLonLatArray = [];
        var allUuidArray = [];
        var allDataArray=[];
        $.ajax({
            url: getHddcGeomorphysvyreprofController() + "/queryAllSpaceData/",
            type: "get",
            async:true,
            success: function (data) {
                for(var i=0;i<data.length;i++){
                    var LonLatString = data[i].extends5;//经纬度字符串
                    if(LonLatString!=null && LonLatString!=""){
                        var LonLatArray = getLonLatArray(LonLatString);//获取经纬度数组
                        //添加经纬度数组
                        allLonLatArray.push(LonLatArray);
                        //添加UUID
                        allUuidArray.push(data[i].uuid);
                    }
                }
                allDataArray = [allUuidArray,allLonLatArray];
            }
        });
        return allDataArray;
    };

    return {
        initQueryGeomorphySvyLineData:initQueryGeomorphySvyLineData,
        initQueryGeomorphySvyRegionData:initQueryGeomorphySvyRegionData,
        initQueryGeomorphySvyReProfData:initQueryGeomorphySvyReProfData
    };
});
